import request from '@/utils/request'
// 通过枚举管理接口
import {
  HospitalDetailResponse,
  HospitalDepartmentResponse,
  HospitalScheduleResponse,
  SearchParams,
  ScheduleDetailResponse,
  ScheduleIdDetailResponse
} from './type'
enum API {
  HOSPITAL_DETAIL_URL = '/hosp/hospital/',
  // 获取某一个医院的科室信息
  HOSPITAL_DEPARTMENT_URL = '/hosp/hospital/department',
  // 获取排版信息
  HOSPITAL_SCHEDULE_URL = '/hosp/hospital/auth/getBookingScheduleRule',
  // 获取某一天的排班信息
  HOSPITAL_SCHEDULE_DAY_URL = '/hosp/hospital/auth/findScheduleList',
  // 根据排版ID获取排班信息
  HOSPITAL_SCHEDULE_ID_URL = '/hosp/hospital/getSchedule',
}

export const reqHospitalDetail = (hascode: string) =>
  request.get<any, HospitalDetailResponse>(`${API.HOSPITAL_DETAIL_URL}/${hascode}`)

export const reqHospitalDepartment = (hascode: string) =>
  request.get<any, HospitalDepartmentResponse>(`${API.HOSPITAL_DEPARTMENT_URL}/${hascode}`)

export const reqHospitalSchedule = (data: SearchParams) =>
  request.get<any, HospitalScheduleResponse>(
    `${API.HOSPITAL_SCHEDULE_URL}/${data.page}/${data.limit}/${data.hoscode}/${data.depcode}`
  )

// 获取某一天的排版信息
export const reqHospitalScheduleDay = (data: {
  hoscode: string
  depcode: string
  workDate: string
}) =>
  request.get<any, ScheduleDetailResponse>(
    API.HOSPITAL_SCHEDULE_DAY_URL + `/${data.hoscode}/${data.depcode}/${data.workDate}`
  )

  // 根据排版ID获取排版信息
  export const reqHospitalScheduleId = (scheduleId: string) => request.get<any, ScheduleIdDetailResponse>(`${API.HOSPITAL_SCHEDULE_ID_URL}/${scheduleId}`)